package my.edu.model.bills.sales.entity.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import jakarta.validation.groups.Default;
import lombok.Data;
import my.edu.common.validate.groups.Insert;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

@Data
public class SalesReturnDTO {
    @Null(message = "id必须为空", groups = {Insert.class})
    @NotNull(message = "id不能为空", groups = {Default.class})
    private Long id;
    @NotBlank(message = "编号不能为空", groups = {Default.class})
    private String orderNo;
    @NotNull(message = "日期不能为空", groups = {Insert.class})
    private LocalDate orderDate;
    @NotNull(message = "客户id不能为空", groups = {Insert.class})
    @Min(value = 1, message = "客户id至少为1", groups = {Insert.class})
    private Long customerId;
    private String customerName;
    private Long salespersonId;
    private String salespersonName;
    private String customerAddress;
    @Min(value = 0, message = "数量必须大于0", groups = {Insert.class})
    private Integer quantity;
    private BigDecimal discountRate;
    @Min(value = 0, message = "金额必须大于0", groups = {Insert.class})
    private BigDecimal discountAmount;//收款优惠
    @Min(value = 0, message = "金额必须大于0", groups = {Insert.class})
    private BigDecimal amountAfterDiscount;
    private Long settlementAccountId;
    private String settlementAccountName;
    private BigDecimal debt;
    private BigDecimal reSalesAmount;//所有退款金额
    @Min(value = 0, message = "金额必须大于0", groups = {Insert.class})
    private BigDecimal reReceivedAmount;//已退款金额
    private Long salesOrderId;
    private String salesOrderNo;
    private Integer sourcePurchaseQuantity;
    private String deliveryMethod;
    private String logisticsNo;
    private String remark;//备注

    @Valid
    @NotEmpty(message = "明细不能为空", groups = {Insert.class})
    private List<SalesReturnDetailDTO> salesReturnDetailDTOList;
}